<!--
 * @Author: WangGuojian 1085844536@qq.com
 * @Date: 2023-08-02 18:59:21
 * @LastEditTime: 2023-08-03 20:20:43
 * @LastEditors: WangGuojian 1085844536@qq.com
 * @FilePath: \vue-basic\08-计算属性\2.姓名案例-methods实现.html
 * @Description:
-->
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=, initial-scale=1.0" />
        <title>姓名案例_methods实现</title>
        <script type="text/javascript" src="../js/vue.js"></script>
    </head>
    <body>
        <!-- 准备好一个容器 -->
        <div id="root">
            姓：<input type="text" v-model="firstName" /> <br /><br />
            名：<input type="text" v-model="lastName" /> <br /><br />
            全名：<span>{{fullName()}}</span>
        </div>
    </body>
    <script type="text/javascript">
        Vue.config.productionTip = false;

        new Vue({
            el: '#root',
            data: {
                firstName: '张',
                lastName: '三',
            },
            methods: {
                fullName() {
                    return this.firstName + '-' + this.lastName;
                },
            },
        });
    </script>
</html>
